/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sellcar;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Fabio Valenzuela
 */
public class Pedidos_Cotação extends javax.swing.JFrame {
        private Connection connection;
    /**
     * Creates new form Pedidos_Cotação
     */
    public Pedidos_Cotação() {
        initComponents();
        this.setLocationRelativeTo(null);
        this.connection = new ConnectionFactory().getConnection();
        getRootPane().setDefaultButton(BtAtualizar);  


    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        TxtCodCarro = new javax.swing.JTextField();
        Titulo = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jSeparator3 = new javax.swing.JSeparator();
        ChTravas = new javax.swing.JCheckBox();
        ChVidros = new javax.swing.JCheckBox();
        jSeparator1 = new javax.swing.JSeparator();
        ChDirHi = new javax.swing.JCheckBox();
        jSeparator2 = new javax.swing.JSeparator();
        ChAbs = new javax.swing.JCheckBox();
        ChArCond = new javax.swing.JCheckBox();
        ChCd = new javax.swing.JCheckBox();
        ChAirBag = new javax.swing.JCheckBox();
        ChAlarme = new javax.swing.JCheckBox();
        ChDvd = new javax.swing.JCheckBox();
        ChTeto = new javax.swing.JCheckBox();
        TxtCor = new javax.swing.JTextField();
        TxtKm = new javax.swing.JTextField();
        TxTFab = new javax.swing.JTextField();
        CombPortas = new javax.swing.JComboBox();
        CombCambio = new javax.swing.JComboBox();
        Cor = new javax.swing.JLabel();
        CombCombust = new javax.swing.JComboBox();
        Km = new javax.swing.JLabel();
        CombModelo = new javax.swing.JComboBox();
        CombMarca = new javax.swing.JComboBox();
        TituloOp = new javax.swing.JLabel();
        RdEstado = new javax.swing.JRadioButton();
        RdOrigem = new javax.swing.JRadioButton();
        Fabric = new javax.swing.JLabel();
        ChBanco = new javax.swing.JCheckBox();
        ChCompu = new javax.swing.JCheckBox();
        ChLimpador = new javax.swing.JCheckBox();
        ChDesen = new javax.swing.JCheckBox();
        Placa = new javax.swing.JLabel();
        ChSensor = new javax.swing.JCheckBox();
        TxtPlaca = new javax.swing.JFormattedTextField();
        BtVoltar = new javax.swing.JButton();
        BtGerar = new javax.swing.JButton();
        BtAtualizar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        Titulo.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        Titulo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Titulo.setText("Cotação de Veiculo");

        jLabel1.setText("Cod/Placa Veiculo");

        ChTravas.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChTravas.setText("Travas Eletricas");

        ChVidros.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChVidros.setText("Vidros Eletricos");

        ChDirHi.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChDirHi.setText("Direção Hidraulica");

        ChAbs.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChAbs.setText("Freio ABS");

        ChArCond.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChArCond.setText("Ar Condicionado");

        ChCd.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChCd.setText("CD Player");

        ChAirBag.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChAirBag.setText("Air Bag");
        ChAirBag.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ChAirBagActionPerformed(evt);
            }
        });

        ChAlarme.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChAlarme.setText("Alarme");

        ChDvd.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChDvd.setText("DVD Player");

        ChTeto.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChTeto.setText("Teto Solar");

        TxtCor.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        TxtKm.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        TxTFab.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        TxTFab.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        CombPortas.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        CombPortas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Portas", "2", "3", "4" }));

        CombCambio.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        CombCambio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Cambio", "Automatica", "Automatica Sequencia", "CVT", "Manual", "Semi-Automatico" }));

        Cor.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        Cor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Cor.setText("Cor");

        CombCombust.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        CombCombust.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Combustivel", "Alcool", "Diesel", "Flex", "Gas Natural", "Gasolina", " " }));

        Km.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        Km.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Km.setText("Kilometragem");

        CombModelo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        CombModelo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Modelo", "Corsa", "Uno", "Focus", "206", "Clio", "Gol" }));

        CombMarca.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        CombMarca.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Marca", "Chevrolet", "Fiat", "Ford", "Peugeot", "Renault", "Volkswagen" }));

        TituloOp.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        TituloOp.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        TituloOp.setText("Opcionais");

        RdEstado.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        RdOrigem.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        RdOrigem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RdOrigemActionPerformed(evt);
            }
        });

        Fabric.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        Fabric.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Fabric.setText("Ano de Fab.");

        ChBanco.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChBanco.setText("Banco de Couro");

        ChCompu.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChCompu.setText("Computador de Bordo");

        ChLimpador.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChLimpador.setText("Limpador Traseiro");

        ChDesen.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChDesen.setText("Desembaçador Traseiro");

        Placa.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        Placa.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Placa.setText("Placa");

        ChSensor.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        ChSensor.setText("Sensor de Estacionamento");

        try {
            TxtPlaca.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("AAA-AAAA")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        TxtPlaca.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        TxtPlaca.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator2)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(CombMarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(CombModelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(CombCombust, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(CombCambio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(CombPortas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(Fabric, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(Placa, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGap(18, 18, 18)
                                        .addComponent(Km, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(Cor, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(TxTFab, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(TxtPlaca, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(TxtKm, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(TxtCor, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(ChAlarme)
                                                .addComponent(ChArCond)
                                                .addComponent(ChCd)
                                                .addComponent(ChDvd))
                                            .addGap(8, 8, 8))
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                            .addComponent(ChAirBag)
                                            .addGap(58, 58, 58)))
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(ChVidros)
                                        .addComponent(ChTeto)
                                        .addComponent(ChTravas)
                                        .addComponent(ChAbs)
                                        .addComponent(ChDirHi))
                                    .addGap(25, 25, 25)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(ChCompu)
                                        .addComponent(ChDesen)
                                        .addComponent(ChLimpador)
                                        .addComponent(ChBanco)
                                        .addComponent(ChSensor)))))
                        .addGap(0, 20, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator1)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(149, 149, 149)
                                .addComponent(RdOrigem)
                                .addGap(132, 132, 132)
                                .addComponent(RdEstado)
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap())
                    .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 547, Short.MAX_VALUE)))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(95, 95, 95)
                .addComponent(TituloOp, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RdEstado)
                    .addComponent(RdOrigem))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CombMarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CombModelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CombCombust, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CombCambio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(CombPortas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Cor)
                    .addComponent(Km)
                    .addComponent(Placa)
                    .addComponent(Fabric))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TxtCor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TxtKm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TxTFab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TxtPlaca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(TituloOp)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ChAirBag)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(1, 1, 1)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ChDirHi)
                            .addComponent(ChSensor))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ChAlarme, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(ChAbs, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(ChBanco, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(ChArCond)
                        .addComponent(ChTravas))
                    .addComponent(ChLimpador, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(ChCd)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(ChDvd))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(ChVidros)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(ChTeto))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ChDesen)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ChCompu)))
                .addGap(16, 16, Short.MAX_VALUE))
        );

        BtVoltar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sellcar/Icones/arrow_left.png"))); // NOI18N
        BtVoltar.setMnemonic('S');
        BtVoltar.setText("Voltar");
        BtVoltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtVoltarActionPerformed(evt);
            }
        });

        BtGerar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sellcar/Icones/printer.png"))); // NOI18N
        BtGerar.setMnemonic('G');
        BtGerar.setText("Gerar");

        BtAtualizar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sellcar/Icones/update.png"))); // NOI18N
        BtAtualizar.setMnemonic('A');
        BtAtualizar.setText("Atualizar");
        BtAtualizar.setToolTipText("");
        BtAtualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtAtualizarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(TxtCodCarro, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BtAtualizar))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(209, 209, 209)
                        .addComponent(Titulo))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(BtVoltar)
                .addGap(18, 18, 18)
                .addComponent(BtGerar)
                .addGap(46, 46, 46))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Titulo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TxtCodCarro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(BtAtualizar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BtVoltar)
                    .addComponent(BtGerar))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ChAirBagActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ChAirBagActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ChAirBagActionPerformed

    private void RdOrigemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RdOrigemActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_RdOrigemActionPerformed

    private void BtVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtVoltarActionPerformed
        // Botão Voltar
        // Encerra a tela de cadastro
        this.dispose();
    }//GEN-LAST:event_BtVoltarActionPerformed

    private void BtAtualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtAtualizarActionPerformed
        // botão atualizar dados;
        String buscar = TxtCodCarro.getText();
try {             
            ResultSet rs = null;
            String sql = "SELECT DESC_ORIGEM,DESC_ESTADO,D.desc_MARCA,desc_cambio,C.desc_MODELO,desc_combustivel,DESC_MODELO_ANO,PLACA,KILOMETRAGEM,COR,AIRBAG,ALARME,AR_CONDICIONADO,CD_PLAYER,DVD_PLAYER,DIR_HIDRAULICA,FREIOS_ABS,TRAVAS_ELETR,VIDROS_ELETR,VALOR_COMPRA,TETO_SOLAR,SENSOR_ESTAC,BANCO_COURO,LIMPADOR_TRAS,DESEMB_TRASEIRO,COMP_BORDO,DESC_PORTA "
            + "from tb_cadastro_veiculos A INNER JOIN TB_COMBUSTIVEL B ON A.id_combustivel = B.id_comb INNER JOIN TB_MARCA D ON A.ID_MARCA = D.ID_MARCA INNER JOIN TB_MODELO C ON A.ID_MODELO = C.ID_MODELO AND C.ID_MARCA = A.ID_MARCA INNER JOIN TB_PORTA E ON A.ID_PORTA = E.ID_PORTA INNER JOIN TB_CAMBIO F ON A.ID_CAMBIO = F.ID_CAMBIO where placa = " +'"' +buscar+'"';
            PreparedStatement stmt = connection.prepareStatement(sql);
            rs = stmt.executeQuery(sql);
            
        DefaultTableModel modeloTabela = null;
        String airbag = null;
        String ALARME = null;
        String AR_CONDICIONADO = null;
        String CD_PLAYER = null;
        String DVD_PLAYER = null;
        String DIR_HIDRAULICA = null;
        String FREIOS_ABS = null;
        String TRAVAS_ELETR = null;
        String VIDROS_ELETR = null;
        String VALOR_COMPRA = null;
        String TETO_SOLAR = null;
        String SENSOR_ESTAC = null;
        String BANCO_COURO = null;
        String LIMPADOR_TRAS = null;
        String DESEMB_TRASEIRO = null;
        String COMP_BORDO = null;
        String DESC_ORIGEM = null;
        String DESC_ESTADO = null;
        
        String desc_combustivel = null;
        String desc_cambio = null;
        String desc_porta = null;
        String desc_MARCA = null;
        String desc_MODELO = null;
        
        if(rs.next()){
           
            modeloTabela = new DefaultTableModel();
            modeloTabela.addColumn("desc_modelo_ano");
            modeloTabela.addColumn("placa");
            modeloTabela.addColumn("kilometragem");
            modeloTabela.addColumn("cor");
            modeloTabela.addColumn("airbag");
            
            
            modeloTabela.addColumn("ALARME");
            modeloTabela.addColumn("AR_CONDICIONADO");
            modeloTabela.addColumn("CD_PLAYER");
            modeloTabela.addColumn("DVD_PLAYER");
            modeloTabela.addColumn("DIR_HIDRAULICA");
            modeloTabela.addColumn("FREIOS_ABS");
            modeloTabela.addColumn("TRAVAS_ELETR");
            modeloTabela.addColumn("VIDROS_ELETR");
            modeloTabela.addColumn("VALOR_COMPRA");
            modeloTabela.addColumn("TETO_SOLAR");
            modeloTabela.addColumn("SENSOR_ESTAC");
            modeloTabela.addColumn("BANCO_COURO");
            modeloTabela.addColumn("LIMPADOR_TRAS");
            modeloTabela.addColumn("DESEMB_TRASEIRO");
            modeloTabela.addColumn("COMP_BORDO");
            modeloTabela.addColumn("DESC_ORIGEM");
            modeloTabela.addColumn("DESC_ESTADO");
            
            
            modeloTabela.addColumn("desc_cambio");
            modeloTabela.addColumn("desc_porta");
            modeloTabela.addColumn("desc_MARCA");
            modeloTabela.addColumn("desc_MODELO");
                
                RdEstado.setText(rs.getString("desc_estado"));
                RdOrigem.setText(rs.getString("desc_origem"));
                TxTFab.setText(rs.getString("desc_modelo_ano"));
                TxtPlaca.setText(rs.getString("placa"));
                TxtKm.setText(rs.getString("kilometragem"));
                TxtCor.setText(rs.getString("cor"));
                
                airbag = rs.getString("airbag");
                
                ALARME = rs.getString("ALARME");
                AR_CONDICIONADO = rs.getString("AR_CONDICIONADO");
                CD_PLAYER = rs.getString("CD_PLAYER");
                DVD_PLAYER = rs.getString("DVD_PLAYER");
                DIR_HIDRAULICA = rs.getString("DIR_HIDRAULICA");
                FREIOS_ABS = rs.getString("FREIOS_ABS");
                TRAVAS_ELETR = rs.getString("TRAVAS_ELETR");
                VIDROS_ELETR = rs.getString("VIDROS_ELETR");
                TETO_SOLAR = rs.getString("TETO_SOLAR");
                SENSOR_ESTAC = rs.getString("SENSOR_ESTAC");
                BANCO_COURO = rs.getString("BANCO_COURO");
                LIMPADOR_TRAS = rs.getString("LIMPADOR_TRAS");
                DESEMB_TRASEIRO = rs.getString("DESEMB_TRASEIRO");
                COMP_BORDO = rs.getString("COMP_BORDO");
                
                
                desc_combustivel = rs.getString("desc_combustivel");
                desc_cambio = rs.getString("desc_cambio");
                desc_porta = rs.getString("desc_porta");
                desc_MARCA  = rs.getString("desc_MARCA");
                desc_MODELO  = rs.getString("desc_MODELO");
                
                
                          
                CombCambio.addItem(desc_cambio);
                CombCombust.addItem(desc_combustivel);
                CombMarca.addItem(desc_MARCA);
                CombModelo.addItem(desc_MODELO);
                CombPortas.addItem(desc_porta);
                
                CombCambio.setSelectedIndex(1);
                CombCombust.setSelectedIndex(1);
                CombMarca.setSelectedIndex(1);
                CombModelo.setSelectedIndex(1);
                CombPortas.setSelectedIndex(1);
                
                if(airbag.equals("1"))
                {
                    ChAirBag.setSelected(true);
                }
                
                if(ALARME.equals("1"))
                {
                    ChAlarme.setSelected(true);
                }
                
                if(AR_CONDICIONADO.equals("1"))
                {
                    ChArCond.setSelected(true);
                }
                                
                if(CD_PLAYER.equals("1"))
                {
                    ChCd.setSelected(true);
                }        
                
                if(DVD_PLAYER.equals("1"))
                {
                    ChDvd.setSelected(true);
                }
                        

                if(DIR_HIDRAULICA.equals("1"))
                {
                    ChDirHi.setSelected(true);
                }
                
                if(FREIOS_ABS.equals("1"))
                {
                    ChAbs.setSelected(true);
                }
                
                if(TRAVAS_ELETR.equals("1"))
                {
                    ChTravas.setSelected(true);
                }
                
                if(VIDROS_ELETR.equals("1"))
                {
                    ChVidros.setSelected(true);
                }
                
                                
                if(TETO_SOLAR.equals("1"))
                {
                    ChTeto.setSelected(true);
                }
                
                if(SENSOR_ESTAC.equals("1"))
                {
                    ChSensor.setSelected(true);
                }
                
                if(BANCO_COURO.equals("1"))
                {
                    ChBanco.setSelected(true);
                }
                
                if(LIMPADOR_TRAS.equals("1"))
                {
                    ChLimpador.setSelected(true);
                }
                
                if(DESEMB_TRASEIRO.equals("1"))
                {
                    ChDesen.setSelected(true);
                }
                
                if(COMP_BORDO.equals("1"))
                {
                    ChCompu.setSelected(true);
                }
                
                

}else JOptionPane.showMessageDialog(null, "VEICULO NÃO CADASTRADO!", "ATENÇÃO!",JOptionPane.WARNING_MESSAGE);        
        } catch (SQLException ex) {
            Logger.getLogger(Cadastro_Usuario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_BtAtualizarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Pedidos_Cotação.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Pedidos_Cotação.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Pedidos_Cotação.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Pedidos_Cotação.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Pedidos_Cotação().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BtAtualizar;
    private javax.swing.JButton BtGerar;
    private javax.swing.JButton BtVoltar;
    private javax.swing.JCheckBox ChAbs;
    private javax.swing.JCheckBox ChAirBag;
    private javax.swing.JCheckBox ChAlarme;
    private javax.swing.JCheckBox ChArCond;
    private javax.swing.JCheckBox ChBanco;
    private javax.swing.JCheckBox ChCd;
    private javax.swing.JCheckBox ChCompu;
    private javax.swing.JCheckBox ChDesen;
    private javax.swing.JCheckBox ChDirHi;
    private javax.swing.JCheckBox ChDvd;
    private javax.swing.JCheckBox ChLimpador;
    private javax.swing.JCheckBox ChSensor;
    private javax.swing.JCheckBox ChTeto;
    private javax.swing.JCheckBox ChTravas;
    private javax.swing.JCheckBox ChVidros;
    private javax.swing.JComboBox CombCambio;
    private javax.swing.JComboBox CombCombust;
    private javax.swing.JComboBox CombMarca;
    private javax.swing.JComboBox CombModelo;
    private javax.swing.JComboBox CombPortas;
    private javax.swing.JLabel Cor;
    private javax.swing.JLabel Fabric;
    private javax.swing.JLabel Km;
    private javax.swing.JLabel Placa;
    private javax.swing.JRadioButton RdEstado;
    private javax.swing.JRadioButton RdOrigem;
    private javax.swing.JLabel Titulo;
    private javax.swing.JLabel TituloOp;
    private javax.swing.JTextField TxTFab;
    private javax.swing.JTextField TxtCodCarro;
    private javax.swing.JTextField TxtCor;
    private javax.swing.JTextField TxtKm;
    private javax.swing.JFormattedTextField TxtPlaca;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    // End of variables declaration//GEN-END:variables
}
